cd "$Mydirectory1/1_DataSources/NLSY79/"

//read in data file
	clear all
	set maxvar 10000
	
	import delimited using ./rawdata/parentsocc_Rage14.csv, clear case(preserve)

label define vlR0001900 11 "FATHER-MOTHER"  12 "FATHER-STEPMOTHER"  13 "FATHER-OTHER WOMAN RELATIVE"  14 "FATHER-OTHER WOMAN"  15 "FATHER-NO WOMAN"  19 "FATHER-MISSING WOMAN"  21 "STEPFATHER-MOTHER"  22 "STEPFATHER-STEPMOTHER"  23 "STEPFATHER-WOMAN RELATIVE"  24 "STEPFATHER-OTHER WOMAN"  25 "STEPFATHER-NO WOMAN"  31 "MAN RELATIVE-MOTHER"  32 "MAN RELATIVE-STEPMOTHER"  33 "MAN RELATIVE-WOMAN RELATIVE"  34 "MAN RELATIVE-OTHER WOMAN"  35 "MAN RELATIVE-NO WOMAN"  41 "OTHER MAN-MOTHER"  42 "OTHER MAN-STEPMOTHER"  43 "OTHER MAN-WOMAN RELATIVE"  44 "OTHER MAN-OTHER WOMAN"  45 "OTHER MAN-NO WOMAN"  51 "NO MAN-MOTHER"  52 "NO MAN-STEPMOTHER"  53 "NO MAN-WOMAN RELATIVE"  54 "NO MAN-OTHER WOMAN"  55 "NO MAN-NO WOMAN"  80 "OTHER ARRANGEMENT"  90 "ON MY OWN"  91 "MISSING MAN-MOTHER"  93 "MISSING MAN-WOMAN RELATIVE" 
label values R0001900 vlR0001900

label define vlR0002100 1 "YES"  0 "NO" 
label values R0002100 vlR0002100

label define vlR0002200 1 "1 TO 195: 001-195 PROFESSIONAL,TECHNICAL AND KINDRED"  201 "201 TO 245: 201-245 MANAGERS,OFFICIALS AND PROPRIETORS"  260 "260 TO 285: 260-285 SALES WORKERS"  301 "301 TO 395: 301-395 CLERICAL AND KINDRED"  401 "401 TO 575: 401-575 CRAFTSMEN,FOREMEN AND KINDRED"  580 "580 TO 590: 580-590 ARMED FORCES"  601 "601 TO 715: 601-715 OPERATIVES AND KINDRED"  740 "740 TO 785: 740-785 LABORERS, EXCEPT FARM"  801 "801 TO 802: 801-802 FARMERS AND FARM MANAGERS"  821 "821 TO 824: 821-824 FARM LABORERS AND FOREMAN"  901 "901 TO 965: 901-965 SERVICE WORKERS, EXCEPT PRIVATE HOUSEHOLD"  980 "980 TO 984: 980-984 PRIVATE HOUSEHOLD"  0 "0: 00      NONE"  990 "990: 990     SAME AS PRESENT JOB"  995 "995: 995     DID NOT WORK"  996 "996: 996     NEVER WORKED" 
label values R0002200 vlR0002200

label define vlR0002400 1 "YES"  0 "NO" 
label values R0002400 vlR0002400

label define vlR0002500 1 "1 TO 195: 001-195 PROFESSIONAL,TECHNICAL AND KINDRED"  201 "201 TO 245: 201-245 MANAGERS,OFFICIALS AND PROPRIETORS"  260 "260 TO 285: 260-285 SALES WORKERS"  301 "301 TO 395: 301-395 CLERICAL AND KINDRED"  401 "401 TO 575: 401-575 CRAFTSMEN,FOREMEN AND KINDRED"  580 "580 TO 590: 580-590 ARMED FORCES"  601 "601 TO 715: 601-715 OPERATIVES AND KINDRED"  740 "740 TO 785: 740-785 LABORERS, EXCEPT FARM"  801 "801 TO 802: 801-802 FARMERS AND FARM MANAGERS"  821 "821 TO 824: 821-824 FARM LABORERS AND FOREMAN"  901 "901 TO 965: 901-965 SERVICE WORKERS, EXCEPT PRIVATE HOUSEHOLD"  980 "980 TO 984: 980-984 PRIVATE HOUSEHOLD"  0 "0: 00      NONE"  990 "990: 990     SAME AS PRESENT JOB"  995 "995: 995     DID NOT WORK"  996 "996: 996     NEVER WORKED" 
label values R0002500 vlR0002500

label define vlR0173600 1 "CROSS MALE WHITE"  2 "CROSS MALE WH. POOR"  3 "CROSS MALE BLACK"  4 "CROSS MALE HISPANIC"  5 "CROSS FEMALE WHITE"  6 "CROSS FEMALE WH POOR"  7 "CROSS FEMALE BLACK"  8 "CROSS FEMALE HISPANIC"  9 "SUP MALE WH POOR"  10 "SUP MALE BLACK"  11 "SUP MALE HISPANIC"  12 "SUP FEM WH POOR"  13 "SUP FEMALE BLACK"  14 "SUP FEMALE HISPANIC"  15 "MIL MALE WHITE"  16 "MIL MALE BLACK"  17 "MIL MALE HISPANIC"  18 "MIL FEMALE WHITE"  19 "MIL FEMALE BLACK"  20 "MIL FEMALE HISPANIC" 
label values R0173600 vlR0173600

label define vlR0214700 1 "HISPANIC"  2 "BLACK"  3 "NON-BLACK, NON-HISPANIC" 
label values R0214700 vlR0214700

label define vlR0214800 1 "MALE"  2 "FEMALE" 
label values R0214800 vlR0214800

  rename R0000100 CASEID_1979 
  rename R0001900 FAM_7_1979   // FAM-7
  rename R0002100 FAM_9_1979   // FAM-9
  rename R0002200 FAM_9A_1979   // FAM-9A
  rename R0002400 FAM_11_1979   // FAM-11
  rename R0002500 FAM_11A_1979   // FAM-11A
  rename R0173600 SAMPLE_ID_1979 
  rename R0214700 SAMPLE_RACE_78SCRN 
  rename R0214800 SAMPLE_SEX_1979 

//drop unnecessary vars
  drop SAMPLE*
  
//save data
	sort CASEID_1979 // uniquely identifies Rs
	compress
	save ./rawdata/parentsocc_Rage14.dta, replace

